package demoMod.stsconsole.commands;

import demoMod.stsconsole.enums.ErrType;
import demoMod.stsconsole.helpers.CharacterManager;
import demoMod.stsconsole.helpers.PromptHelper;
import demoMod.stsconsole.helpers.SaveHelper;

import java.util.Scanner;

public class Resume extends AbstractCommand {
    @Override
    public void execute(String[] args, Scanner sc) {
        if (args.length != 0) {
            this.errMsg(ErrType.WRONG_ARGUMENT);
            return;
        }
        if (!SaveHelper.saveExists()) {
            this.errMsg(ErrType.SAVE_NOT_EXIST);
            return;
        }
        if (CharacterManager.createCharacter(0)) {
            PromptHelper.backwardPrompt();
            PromptHelper.appendPrompt("Dungeon");
            SaveHelper.load();
        }
    }

    @Override
    public boolean requiredPrompt(String currentPrompt) {
        return "".equals(currentPrompt);
    }
}
